<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let arr = [];
        arr.length = 200;
        arr.fill(1, 0, 100)

        /*   for (let k in arr) {
              console.log(k)
              if (k == 10) {
                  break
              }
          }
   */


        /*  let i = 0;
         for (let k of arr) {
             console.log(k)
             if (i == 10) {
                 break
             }
             i++
         } */


        //forEach 不能中断循环 break return
        /* arr.forEach((v, i) => {
            if (i == 3) {
                console.log(i)
                console.log(v)
                break
            }
        }) */

        for (let i = 0; i < arr.length; i++) {
            console.log(i)
            if (i === 5) {
                break
            }
        }
    </script>
</body>

</html>